package chapter4.No4_1_使用reentrantLock类.demo11;

import java.util.concurrent.locks.ReentrantLock;

/**
 * Created by Administrator on 2016/11/21.
 */
public class Service {
    ReentrantLock lock;

    public Service(boolean flag) {
        this.lock = new ReentrantLock(flag);
    }

    public void methodA() {
        lock.lock();
        System.out.println("线程" + Thread.currentThread().getName() + "：开始执行方法");
        lock.unlock();
    }
}
